package com.cloud.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Component;

import com.cloud.core.BaseDao;
import com.cloud.dao.CodeBean;
import com.cloud.dao.HospitalBean;

/**
 * 1Cloud1
 * @author Administrator
 * @since 2015-12-4
 * @version 1.0 
 */
@Component("CodeDao")
public class CodeDao extends BaseDao {
	
	public List<CodeBean> getDepartmentList(){
		SqlSession session = super.getInstance(true);
		List<CodeBean> beanList = null;
		try {
			beanList = session.selectList("code.department");
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
	
	public List<CodeBean> getDictList(){
		SqlSession session = super.getInstance(true);
		List<CodeBean> beanList = null;
		try {
			beanList = session.selectList("code.dict");
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
	
	public List<CodeBean> getDiseaseList(){
		SqlSession session = super.getInstance(true);
		List<CodeBean> beanList = null;
		try {
			beanList = session.selectList("code.disease");
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
	
	public List<CodeBean> getTitleList(){
		SqlSession session = super.getInstance(true);
		List<CodeBean> beanList = null;
		try {
			beanList = session.selectList("code.title");
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
	
	public List<CodeBean> getLableList(){
		SqlSession session = super.getInstance(true);
		List<CodeBean> beanList = null;
		try {
			beanList = session.selectList("code.lable");
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
	
	public List<HospitalBean> getHospitalList(HospitalBean bean){
		SqlSession session = super.getInstance(true);
		List<HospitalBean> beanList = null;
		try {
			beanList = session.selectList("code.hospital", bean);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
	
	public List<CodeBean> getCompanyList(String comname){
		SqlSession session = super.getInstance(true);
		List<CodeBean> beanList = null;
		try {
			beanList = session.selectList("code.company", comname);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
}
